﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using TwitterClient2.Controller;

namespace TwitterClient2.Components
{
    public class TabPageSend : TabPage
    {
        private Button buttonSend;
        public TextBox textBoxSendToValue;
        public TextBox textBoxMessageText;
        private Label labelSendTo;
        private TwitterClientController controller = TwitterClientController.getInstance();
        public TabPageSend()
        {
            InitializeComponent();
        }

        private void InitializeComponent()
        {
            this.labelSendTo = new System.Windows.Forms.Label();
            this.buttonSend = new System.Windows.Forms.Button();
            this.textBoxSendToValue = new System.Windows.Forms.TextBox();
            this.textBoxMessageText = new System.Windows.Forms.TextBox();
            this.SuspendLayout();
            // 
            // labelSendTo
            // 
            this.labelSendTo.Location = new System.Drawing.Point(10, 10);
            this.labelSendTo.Name = "labelSendTo";
            this.labelSendTo.Size = new System.Drawing.Size(100, 20);
            this.labelSendTo.Text = "Send to:";
            // 
            // buttonSend
            // 
            this.buttonSend.Location = new System.Drawing.Point(138, 190);
            this.buttonSend.Name = "buttonSend";
            this.buttonSend.Size = new System.Drawing.Size(72, 20);
            this.buttonSend.TabIndex = 0;
            this.buttonSend.Text = "Send";
            this.buttonSend.Click += new System.EventHandler(this.buttonSend_Click);
            // 
            // textBoxSendToValue
            // 
            this.textBoxSendToValue.Location = new System.Drawing.Point(110, 10);
            this.textBoxSendToValue.Name = "textBoxSendToValue";
            this.textBoxSendToValue.Size = new System.Drawing.Size(100, 21);
            this.textBoxSendToValue.TabIndex = 0;
            // 
            // textBoxMessageText
            // 
            this.textBoxMessageText.Location = new System.Drawing.Point(10, 40);
            this.textBoxMessageText.Multiline = true;
            this.textBoxMessageText.Name = "textBoxMessageText";
            this.textBoxMessageText.Size = new System.Drawing.Size(200, 140);
            this.textBoxMessageText.TabIndex = 0;
            // 
            // TabPageSend
            // 
            this.BackColor = System.Drawing.Color.LightGray;
            this.Controls.Add(this.labelSendTo);
            this.Controls.Add(this.textBoxSendToValue);
            this.Controls.Add(this.textBoxMessageText);
            this.Controls.Add(this.buttonSend);
            this.ResumeLayout(false);

        }

        private void buttonSend_Click(object sender, EventArgs e)
        {
            if (!this.textBoxMessageText.Text.Equals("") && !this.textBoxSendToValue.Text.Equals(""))
            {
                TwitterClientEvent tEvent = new TwitterClientEvent();
                tEvent.paramList.Add(this.textBoxSendToValue.Text);
                tEvent.paramList.Add(this.textBoxMessageText.Text);
                Cursor.Current = Cursors.WaitCursor;
                this.controller.performUserInput(TwitterClientController.SEND_DIRECT_MESSAGE, tEvent);
                Cursor.Current = Cursors.Default;
            }
        }


    }
}
